/// 判断是否是基本类型
bool isBaseType(data) {
  return (data is int || data is double || data is String || data is bool);
}

/// 判断是否是基本类型和Map和List类型，非自定义的类类型
bool isNotClassType(data) {
  return isBaseType(data) ||
      data == null ||
      data is Map ||
      data is List ||
      data is Set ||
      data is Function;
}

/// [data] = "a.b.c" 转化为 [“a”,“b”,"c"]
/// 把包含字符串的点转化为字符串数组
List<dynamic> getKeylist(key) {
  if (key is int) return [key];
  if (!(key is String && key != '')) {
    print('getKeylist必须接收一个非空字符串');
    throw Error();
  }
  List<String> keyList = key.split('.');
  keyList = keyList.where((element) => element != '').toList();
  List<dynamic> resList = [];
  keyList.forEach((ele) {
    try {
      resList.add(int.parse(ele));
    } catch (e) {
      resList.add(ele);
    }
  });
  return resList;
}

// List去重
List<T> listUnRepeat<T>(List<T> originList) {
  Set<T> _tempSet = {};
  _tempSet.addAll(originList);
  return _tempSet.toList();
}
